#set( $symbol_pound = '#' )
#set( $symbol_dollar = '$' )
#set( $symbol_escape = '\' )
package ${package}.demo.module.role.controller;

import ${package}.auth.YkAuthRoleDemoClient;
import ${package}.common.bean.vo.AddRoleVo;
import ${package}.common.bean.vo.JsonResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;

/**
 * Description: 角色模块openfeign调用demo
 *
 * @author songcx
 * @date 2019/8/21 10:14
 *
 * <pre>
 *              ${copyright}
 *      Copyright (c) 2019. All Rights Reserved.
 * </pre>
 */
@RestController
@Slf4j
@AllArgsConstructor
@RequestMapping("/demo/role/")
@Api(description = "角色模块feign调用demo")
public class RoleController {

    /**
     *feign调用角色模块客户端
     */
    YkAuthRoleDemoClient ykAuthRoleDemoClient;

    /**
     * Description:
     * <openfeign调用put请求传递实体类demo>
     * @author songcx
     * @date 10:50 2019/8/21
     * @param addRoleVo 1
     * @return JsonResult
     **/
    @PutMapping("addRole")
    @ApiOperation(value = "新增角色",notes = "新增角色")
    @ApiImplicitParam(name = "addRoleVo",value = "新增角色实体类",dataType = "AddRoleVo",paramType = "body",required = true)
    public JsonResult addRole(@RequestBody @Valid AddRoleVo addRoleVo){
        return ykAuthRoleDemoClient.addRole(addRoleVo);
    }

    /**
     * Description:
     * <openfeign调用get请求传递多个参数demo>
     * @author songcx
     * @date 11:09 2019/8/21
     * @param name 1
     * @param id 2
     * @return JsonResult<java.lang.Boolean>
     **/
    @GetMapping("/{name}/{id}")
    @ApiOperation(value = "查询是否重复名称",notes = "查询是否重复名称")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "name",value = "角色名称",dataType = "String",paramType = "path",required = true),
            @ApiImplicitParam(name = "id",value = "角色id",dataType = "Long",paramType = "path",required = true)
    })
    public JsonResult<Boolean> roleVerifyName(@PathVariable(value = "name") String name, @PathVariable(value = "id") Long id){
        return ykAuthRoleDemoClient.roleVerifyName(name,id);
    }
}
